package com.mdlib.helper.ui.adapter;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ljlib.core.util.common.TimeUtils;
import com.ljlib.help.R;
import com.mdlib.helper.model.entity.VoucherEntity;

import java.util.List;

/**
 * 作者：HQY on 16/11/21 15:28
 * 邮箱：hqy_xz@126.com
 */

public class VoucherDialogAdapter extends BaseQuickAdapter<VoucherEntity> {

    public VoucherDialogAdapter(List<VoucherEntity> data) {
        super(R.layout.item_dialog_voucher, data);
    }


    @Override
    protected void convert(BaseViewHolder baseViewHolder, VoucherEntity voucherEntity) {

        baseViewHolder.setChecked(R.id.iv_voucher_check, voucherEntity.isSelected());
        baseViewHolder.setVisible(R.id.iv_voucher_check, voucherEntity.isSelected());
        baseViewHolder.addOnClickListener(R.id.rl_dialog_bg);
        baseViewHolder.setText(R.id.tv_voucher_title, voucherEntity.getTitle());
        baseViewHolder.setText(R.id.tv_voucher_money, voucherEntity.getValue());
        baseViewHolder.setText(R.id.tv_voucher_time, "截止日期：" + TimeUtils.milliseconds2String(Long.valueOf(voucherEntity.getExpireTime()) * 1000));


    }
}
